package com.zky.gulimall.product;

import com.alibaba.fastjson.JSON;

/**
 * @Description TODO
 * @Author 张开源
 * @Date 2022/11/6 18:14
 * @Version 1.0
 **/
public class BubbleSort {
    public static void main(String[] args) {
        int[] arr={10,100,5,19,23,30,200,400,24,45,32,20,10,34};

        System.out.println(JSON.toJSON(arr));

        for (int i = 0; i < arr.length-1; i++) {
            for (int j = 0; j < arr.length-1-i; j++) {
                if(arr[j]>arr[j+1]){
                    int temp=arr[j];
                    arr[j]=arr[j+1];
                    arr[j+1]=temp;
                }
            }
        }

        System.out.println(JSON.toJSON(arr));
    }
}
